package top.dark.product.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import top.dark.product.service.SkuInfoService;
import top.dark.product.vo.SkuItemVo;
import java.util.concurrent.ExecutionException;

/**
 * Author: Darkn
 * description:
 * Create Time: 2021/3/17 9:40
 */
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    @RequestMapping("/{skuId}.html")
    public String skuItemInfo(@PathVariable("skuId") Long skuId, Model model) throws ExecutionException, InterruptedException {
        SkuItemVo skuItemVo = skuInfoService.itemInfo(skuId);
        model.addAttribute("skuItemVo", skuItemVo);
        return "item";
    }

}
